<!--
 * @Author: your name
 * @Date: 2021-08-25 16:01:11
 * @LastEditTime: 2021-08-25 16:07:01
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /web-blog/src/pages/dashboard/blog/dataAnalysis/rank.vue
-->

<template>
  <div>
    <a-card>
      <div>排名前三笔记</div>
      <div id="myChart" :style="{width: '1000px', height: '600px'}"></div>
    </a-card>
  </div>
</template>

<script>

export default {
  data() {
    return {

    }
  },
  mounted(){
    this.drawLine();
  },
  methods: {
    drawLine(){
        // 基于准备好的dom，初始化echarts实例
        let myChart = this.$echarts.init(document.getElementById('myChart'))
        // 绘制图表
        myChart.setOption({
             tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        top: 'bottom',
        data: ['已上报', '未上报','已发布']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '8%',
        containLabel: true
    },
    yAxis: {
        type: 'value',
        
        splitLine: {
            show: true,
            lineStyle: {
              color: '#D2E6F9',
              type: 'dashed'
            }
          },
          axisLine: {
            lineStyle: {
              color: '#D2E6F9'
            }
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            color: '#000'
          }
    },
    xAxis: {
        type: 'category',
        data: ['访问量', '评论数', '点赞数'],
        axisLine: {
            lineStyle: {
              color: '#D2E6F9'
            }
          },
          axisTick: {
            show: false
          },
          axisLabel: {
            color: '#000'
          }
    },
    series: [
        {
            name: '已上报',
            type: 'bar',
            barWidth: 24,
            barGap: '40%',
            data: [18, 23, 29],
            itemStyle: {
                barBorderRadius: [4, 24, 0, 0],
                color: {
                    type: 'linear',
                    x: 0,
                    y: 1,
                    x2: 0,
                    y2: 0,
                    colorStops: [{
                        offset: 0, color: '#8BDCFF' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#4594E8' // 100% 处的颜色
                    }],
                    global: false // 缺省为 false
                }
            }
        },
        {
            name: '未上报',
            type: 'bar',
            barWidth: 24,
            barGap: '40%',
            data: [23, 28, 36],
            itemStyle: {
                barBorderRadius: [4, 24, 0, 0],
                color: {
                    type: 'linear',
                    x: 0,
                    y: 1,
                    x2: 0,
                    y2: 0,
                    colorStops: [{
                        offset: 0, color: '#FFB2B2' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#F45353' // 100% 处的颜色
                    }],
                    global: false // 缺省为 false
                }
            }
        },
        {
            name: '已发布',
            type: 'bar',
            barWidth: 24,
            barGap: '40%',
            data: [26, 32, 20],
            itemStyle: {
                barBorderRadius: [4, 24, 0, 0],
                color: {
                    type: 'linear',
                    x: 0,
                    y: 1,
                    x2: 0,
                    y2: 0,
                    colorStops: [{
                        offset: 0, color: '#59FFB7' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#37BDFF' // 100% 处的颜色
                    }],
                    global: false // 缺省为 false
                }
            }
        }
    ]
        });
    }
  }
}
</script>

<style lang="less" scoped>

</style>
